#!/usr/bin/env pytho
#coding=utf-8
def check(a):
    for i in xrange(999,99,-1):
        if a%i==0 and 100<a/i<999:
            return True
    return False

a = 999999
lst = [1100,10010,100001]
for i in xrange(0,10):
    for j in xrange(0,10):
        for k in xrange(0,10):
            a -= lst[0]*k + lst[1]*j + lst[2]*i
            if check(a):
                print a
                exit()
            else:
                a = 999999